<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>显示登记信息</title>
    <link rel="stylesheet" href="webjars/bootstrap/3.3.5/css/bootstrap.css" type="text/css">
    <script src="webjars/jquery/3.4.1/jquery.js"></script>
</head>
<body>
<h2>登记信息列表&emsp;&emsp;
    <button type="button" onclick="history.go(-1)" class="glyphicon glyphicon-share-alt"
            aria-hidden="true" th:bgcolor="grey"></button></h2>
<table>
    <form action="/searchC">
        <tr>
            <td>查询条件：&emsp;</td>
            <td bgcolor="#f0ffff">&emsp;<input name="name" type="text" placeholder="请输入登记人姓名"></td>
            <td bgcolor="#f0ffff">&emsp;<input type="submit" value="查询"></td>
            <td>&emsp;&emsp;&emsp;&emsp;&emsp;<a th:href="@{'/addCin'}" class="btn btn-info">
                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>登记</a></td>
        </tr>
    </form>
</table>
<table class="table table-hover">
    <tr>
        <th>序号</th>
        <th>客户姓名</th>
        <th>性别</th>
        <th>年龄</th>
        <th>身份证号</th>
        <th>房间号</th>
        <th>所属楼房</th>
        <th>档案号</th>
        <th>入住时间</th>
        <th>合同到期时间</th>
        <th>联系人电话</th>
        <th>家属</th>
        <th>陪住人</th>
        <th>评估医生</th>
        <th>负责医生</th>
        <th>护工</th>
        <th>健康管家</th>
        <th>操作人</th>
        <th>备注</th>
        <th>其它操作</th>
    </tr>
    <tr th:each="cin:${cins}">
        <td th:text="${cin.id}"></td>
        <td th:text="${cin.name}"></td>
        <td th:text="${cin.sex}"></td>
        <td th:text="${cin.age}"></td>
        <td th:text="${cin.idcard}"></td>
        <td th:text="${cin.rnumber}"></td>
        <td th:text="${cin.bnumber}"></td>
        <td th:text="${cin.fnumber}"></td>
        <td th:text="${cin.citime}"></td>
        <td th:text="${cin.cetime}"></td>
        <td th:text="${cin.cnumber}"></td>
        <td th:text="${cin.family}"></td>
        <td th:text="${cin.accompany}"></td>
        <td th:text="${cin.assessmentdo}"></td>
        <td th:text="${cin.chargedo}"></td>
        <td th:text="${cin.careworker}"></td>
        <td th:text="${cin.healthsteward}"></td>
        <td th:text="${cin.operator}"></td>
        <td th:text="${cin.remarks}"></td>
        <td>
            <a th:href="@{'/checkin/'+${cin.id}}" class="btn btn-info">修改</a>
            <a th:onclick="|deleteCin(this, ${cin.id})|" class="btn btn-warning">删除</a>
        </td>
    </tr>
</table>
<script>
    function deleteCin(obj,id) {
        if(confirm("确定要删除么？")){
            alert("要删除的所登记编号："+id);
            //发送删除操作请求
            $.ajax({
                url: "/checkin/"+id,
                type: "DELETE",
                success: function (result) {
                    // alert(result);
                    if(result==="success"){
                        //删除当前行
                        $(obj ).parent().parent().remove();
                    }else{
                        alert("这个信息不能删除....");
                    }
                }
            });
        }else{
            alert("撤销删除操作")
        }

    }
</script>
</body>
</html>